import ViewUI from 'view-design';
import '_/assets/styles/index.less';
import settings from "@/settings";
import { router } from '_/support';
import { showTitle } from "_/utils/tools";
settings.merge({ plugins: { iview: { transfer: true, size: "default" } } });
export default {
  install(Vue) {
    Vue.use(ViewUI, settings.plugins.iview);
    ViewUI.Notice.config({ top: 50, duration: 3 });
    router.beforeEach((to, from, next) => {
      ViewUI.LoadingBar.start();
      next();
    });
    router.afterEach(to => {
      const { title } = settings.website;
      const pageTitle = showTitle(to);
      const resTitle = pageTitle ? `${pageTitle} - ${title}` : title;
      window.document.title = resTitle
      window.scrollTo(0, 0);
      ViewUI.LoadingBar.finish();
    });
  }
}
